from django.core.files.storage import Storage

from meiduo_mall import settings


class FastDFSStorage(Storage):
    def __init__(self, fdfs_base_url=None):
        """
        构造方法，可以不带参数，也可以携带参数
        :param base_url: Storage的IP
        """
        self.fdfs_base_url = fdfs_base_url or settings.FDFS_BASE_URL
    def _open(self, name, mode='rb'):
        pass
    def _save(self, name, content, max_length=None):
        pass
    def url(self, name):
        # return 'http://192.168.242.136:8888/'+name
        return self.fdfs_base_url + name


# class Person(Storage):
#     def __init__(self,name=None):
#         pass
#
# p=Person()
